
package Logger;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;



public class MainLogger {
        
               
        private static FileHandler handler;
        private static final Logger logger = Logger.getLogger("lab2_generic");
        private static InputStream input; 
        
        public static void createLogger() {
            
           try{
           
           input = new FileInputStream("logger_config.txt");  // file in home path with configuration file
           LogManager.getLogManager().readConfiguration(input);
           } catch(IOException | SecurityException e){
               e.printStackTrace();
           } 
            
            
        }
        
        public static void changeLevel(Level lvl){
            
            logger.setLevel(lvl);
        }
        
        public static void activeLogger(){
            logger.setLevel(Level.ALL);
        }
        
        public static void deactivateLogger(){
            logger.setLevel(Level.OFF);
        }
       
}
